import * as React from 'react';

let context = React.createContext();
// 设置全局初始值
const initState = {
  userInfo: {},
};
// 返回体必须是 Object.assign({}, state);
function reducer(state = {}, action) {
  switch (action.type) {
    case 'changeUserInfo':
      state.userInfo = action.data;
      return Object.assign({}, state);

    default:
      throw new Error();
  }
}

export {initState, context, reducer};
